package com.hllxd.hism.star.basic.service.service;


import com.hllxd.hism.star.basic.service.dao.mapper.mis.TaskBaselineMapper;
import com.hllxd.hism.star.basic.service.model.cost.TaskBaselineEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 任务基线管理
 *
 * @author lixiyong
 * @date 2020/12/20 16:15
 */
@Slf4j
@Service("taskBaselineService")
public class TaskBaselineServiceImpl implements TaskBaselineService {

    final static String ZERO = "0";
    private static final Long KB = 1024L;
    private static final Long MB = 1024L * 1024L;
    private static final Long GB = 1024L * 1024L * 1024L;
    private static final Long TB = 1024L * 1024L * 1024L * 1024L;
    private static final Long PB = 1024L * 1024L * 1024L * 1024L * 1024L;
    @Autowired
    private TaskBaselineMapper taskBaselineMapper;

    @Override
    public List<TaskBaselineEntity> listTaskBaseline() {
        return taskBaselineMapper.listTaskBaseline();
    }

    @Override
    public TaskBaselineEntity getTaskBaseline(Long id) {
        return taskBaselineMapper.getTaskBaseline(id);
    }

    @Override
    public long setTaskBaseline(TaskBaselineEntity aa) {
        if (aa.getId() != null && aa.id>0L) {
            return taskBaselineMapper.updateTaskBaseline(aa);
        }
        return taskBaselineMapper.insertTaskBaseline(aa);
    }

    @Override
    public long delTaskBaseline(String id) {
        log.info("delete baseline id: {}", id);
        taskBaselineMapper.deleteTaskBaseline(id);
        return 0L;
    }

}
